<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>063-函数递归调用求阶乘.html</title>
</head>
<body>
	
</body>
<script>
	/*
	5! = 5 * 4!;
	4! = 4 * 3!;
	3! = 3 * 2!;
	2! = 2 * 1!;
	1! = 1;
	0! = 1;

	n! = n * (n -1)!;
    */
   
	function fact(num){
		
		if(num == 1){
			return 1;
		}

		// console.log(fact);
		// console.log(arguments.callee);
		// return num * fact(num-1);
		return num * arguments.callee(num-1);
		// return num * (num-1)
	}
	var fact2 = fact;

	fact = 1;
	console.log(fact)
	console.log(fact2(5));
	// fact(5);
</script>
</html>